using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using NFixedPoint;
using UnityEditor;
using UnityEngine;

namespace ColliderSystem
{
    public static class NNTools
    {
        public static FixedPoint3 ToFixedPoint3(this Vector3 v1)
        {
            return new FixedPoint3((FixedPoint)v1.x, (FixedPoint)v1.y, (FixedPoint)v1.z);
        }

        public static Vector3 ToVector3(this FixedPoint3 v1)
        {
            return new Vector3(v1.x.AsFloat, v1.y.AsFloat, v1.z.AsFloat);
        }

        public static void SerializeObject<T>(T list, string filePath)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            using (FileStream stream = new FileStream(filePath, FileMode.Create))
            {
                formatter.Serialize(stream, list);
            }
        }
    }
}
